package net.proef.sample.xml;

import net.proef.commons.lang.builder.ExtendedToStringStyle;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class XMLAddress {
	private String street;
	private String town;
	private String state;
	private String postalCode;

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getTown() {
		return town;
	}

	public void setTown(String town) {
		this.town = town;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getPostalCode() {
		return postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof XMLAddress) {
			XMLAddress a = (XMLAddress) obj;

			return new EqualsBuilder().append(this.postalCode, a.postalCode)
					.append(this.town, a.town).append(this.street, this.street)
					.isEquals();

		}
		return false;
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(7, 3).append(this.postalCode)
				.append(this.town).append(this.street).toHashCode();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this,
				ExtendedToStringStyle.SHORT_PREFIX_NO_FIELD_NAMES_STYLE)
				.append("town", this.town).append("street", this.street)
				.toString();
	}
}
